using System;
using System.Collections.Generic;
using System.Text;

namespace Enyo.Reflection
{
	public class Type<T> : Enyo.Reflection.Type
	{
		public Type(params System.Type[] generics)
			: base(typeof(T), generics)
		{
		}

		public Type()
			: base(typeof(T))
		{
		}
		public Type(System.Type type)
			: base(type)
		{
		}

		public new virtual T CreateInstance()
		{
			return this.Instance;
		}

		public T Instance
		{
			get
			{
				return (T)base.Assembly.CreateInstance(base.FullName);
			}
		}

		public static T CreateInstance(System.Type t, params System.Type[] generic)
		{
			return (T)Activator.CreateInstance(t.MakeGenericType(generic));
		}

		public static T CreateNewInstance()
		{
			return new Type<T>().Instance;
		}

		public new static System.Type[] GetDerived()
		{
			return Type.GetDerived(typeof(T));
		}

		public override System.Type RuntimeType
		{
			get { return typeof(T); }
		}
	}
}
